package com.example.selectdorm.service;


import com.example.selectdorm.entity.UserInfo;
import com.example.selectdorm.repo.UserInfoRepository;
import lombok.AllArgsConstructor;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class UserInfoService {
    private final UserInfoRepository userInfoRepository;

    public UserInfo getByStudentId(String studentId) {
        return userInfoRepository.findByStudentId(studentId)
                .orElseThrow(() -> new UsernameNotFoundException("no such student Id"));
    };
}
